package cn.sumpu.app.guoguojie.dao.impl;

import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.sumpu.app.guoguojie.dao.AuxIdentifierDao;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public class AuxIdentifierDaoImpl extends SqlSessionDaoSupport implements AuxIdentifierDao {

    private final static Logger logger = LoggerFactory.getLogger(AuxIdentifierDaoImpl.class);

    /**
     * @author nick
     * @param map
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.dao.AuxIdentifierDao#getIdBySeq(java.util.Map)
     */
    @Override
    public int getIdBySeq(Map<String, Object> map) throws AppBusinessException {
        try {
            return (Integer) getSqlSession().selectOne("cn.sumpu.app.guoguojie.persistence.AuxIdentifierMapper.getIdBySeq", map);
        } catch (Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error("Query database failure.", e);
            }
            throw new AppBusinessException("Query database failure.", e);
        }
    }

}
